#!/bin/sh

. /usr/share/common

HTTPD_CONF="/etc/httpd.conf"
PORTAL_CONF="/etc/httpd-portal.conf"

if [ -f "$PORTAL_MODE_FLAG" ]; then
	DAEMON_ARGS="-f -c $PORTAL_CONF"
else
	DAEMON_ARGS="-f -c $HTTPD_CONF -r Authentication"
fi

if [ "0$debug" -gt 0 ]; then
	sed -i 's/^\/x:root/#\/x:root/' $HTTPD_CONF
else
	sed -i 's/^#\/x:root/\/x:root/' $HTTPD_CONF
fi

start() {
	echo_title "Starting HTTPD"

	start_daemon
}

stop() {
	echo_title "Stopping HTTPD"

	stop_daemon
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		sleep 1
		start
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
		;;
esac

exit 0
